home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume6 / glib / part02 < prev    next >
Encoding:
Text File  |  1989-05-21  |  54.1 KB  |  2,004 lines

  1. Newsgroups: comp.sources.misc
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Subject: v06i114: repost of glib/part02 (original was truncated)
  4. Supersedes: <54813@uunet.uu.net>
  5. Reply-To: lee%uhccux.bitnet@cunyvm.cuny.edu (Greg Lee)
  6.  
  7. Posting-number: Volume 6, Issue 114
  8. Submitted-by: lee%uhccux.bitnet@cunyvm.cuny.edu (Greg Lee)
  9. Archive-name: glib/part02
  10.  
  11. It appears that a net.line.eater decided to snack on the bottom half of
  12. glib/part02 (volume 6, issue 103).  This posting supersedes it and overwrites
  13. its archive entry.  Archive maintainers take note.
  14.  
  15. ++Brandon
  16. ------------------
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 2 (of 15)."
  24. # Contents:  CHANGES DX-README ctomenu.l cz.h d10tva.mnu d10tvf.mnu
  25. #   d10wfg.mnu k1single.mnu pc-mach.h st-mach.c
  26. # Wrapped by lee@uhccux on Sun May  7 00:40:09 1989
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'CHANGES'\"
  30. else
  31. echo shar: Extracting \"'CHANGES'\" \(4379 characters\)
  32. sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
  33. X
  34. X3/15/89 Makefile    changed K5 to KAWAIK5 (fix from Jessica Koeppel)
  35. X    list.c        changed K5 to KAWAIK5; restored cvtanum() value
  36. X            to editinfo arrays
  37. X    glib.h        restored cvtanum() to editinfo declaration
  38. X    glib.c        restored cvtanum() use (for Kawai K1 and K5 now);
  39. X            restored some other things from Thompson's more
  40. X            recent version
  41. X    k1multi.mnu    now number of single patch is always shown, even
  42. X            when the name is shown
  43. X    glib.1        added paragraph about display of single names
  44. X            when editing multi patches for the K1
  45. X----------------------------
  46. Xabove changes posted as patch1.
  47. X----------------------------
  48. X3/16/89    glib.c        mistake in last patch lost code in gotoparm()
  49. X            required for arrow key use -- put it back;
  50. X            remove "Voices" from screen title of synth bank
  51. X    glib.1        documented `N' command for entering voice name.
  52. X    glib.h,
  53. X    unix-mach.c    revised ctl() macro and calls as suggested by
  54. X            Mac Michaels for sake of Turbo C
  55. X    amigmach.c    Alan Bland's comp.sources.amiga distribution
  56. X            increases a buffer size -- made that change here
  57. X----------------------------
  58. Xabove changes posted as patch2.
  59. X----------------------------
  60. X3/20/89    glib.man    now corresponds with glib.1
  61. X    patchlevel.h    new, to keep track of patchlevel
  62. X    CHANGES        new, this file
  63. X    MANIFEST    includes above, and this changes file
  64. X3/30/89 k1multi.mnu    changed data from row order to column order
  65. X    k1vis.c        in vismute() changed sense of 'mute' and 'on'
  66. X----------------------------
  67. Xabove changes posted as patch3.
  68. X----------------------------
  69. Xchanges of 4/19/89 by Scott Snyder:
  70. X4/19/89    glib.c        enhance showstr(); pass the 'eras' parameter
  71. X            to the vis routine in showparam(); speed up
  72. X            paramat() and parmindex(); added special
  73. X            processing in readall() for DX7 and DX7s
  74. X            banks.
  75. X    list.c        added DX7 and DX7s.
  76. X    pc-mach.h    added definitions for graphics chars.
  77. X    pc-tcc.mak    revised along the lines of the unix makefile.
  78. X    menutoc.l    expanded the number of acceptable %'s and #'s;
  79. X            changed the type of the temp vars it generates
  80. X            from 'unsigned char' to 'unsigned'; allowed
  81. X            specification of input and output files as
  82. X            parameters in order to work with TMAKE.
  83. X            fixed bug with zero offsets.
  84. X    menutoc.c    see menutoc.l
  85. X    patchlevel.h    keep track of revisions.
  86. X4/22/89 Makefile    updated for dx7; change to prevent deleting
  87. X            menutoc.c automatically by make
  88. X    MANIFEST    reflects new dx7 files
  89. X    dx7.mnu        joined 2 quotes split across lines not accepted
  90. X            by pcc; had to comment out #pragma dir. in 2 places
  91. X    dx7s.mnu    added #define of SEEK_CUR
  92. X    list.c        termination of editinfo was missing a 0
  93. X    glib.1,glib.man,README
  94. X            minor changes
  95. X----------------------------
  96. Xabove changes made in patch4 (3 parts)
  97. X----------------------------
  98. X4/23/89    glib.c,glib.h,unix-mach.c
  99. X            new U and D commands for unix: upload and download
  100. X            file instead of synth
  101. X    glib.1,glib.man    document above
  102. X    k1multi.mnu    disabled k1sedit proc (don't know how to do this)
  103. X    k1multi.mnu,k1single.mnu
  104. X            should not include machdep.h
  105. X    yama_com.c,tx81p.mnu
  106. X            gbulk: read and discard 0xf0 when download from file;
  107. X            sbulk: returns 0
  108. X    patchlevel.h    now level 5
  109. X----------------------------
  110. Xabove changes posted as patch5
  111. X----------------------------
  112. X4/24/89    k1multi.mnu    upload and download multi-voice dumps instead of
  113. X            doing one voice at a time
  114. X4/25/89
  115. X -- started to use RCS; add $Id: CHANGES,v 1.6 89/05/06 17:13:05 lee Exp $, $Author: lee $, $Log:    CHANGES,v $
  116. X# Revision 1.6  89/05/06  17:13:05  lee
  117. X# rel. to comp.sources.misc
  118. X# 
  119. X# Revision 1.6  89/04/26  10:34:18  lee
  120. X# none
  121. X#  to most files ---
  122. X4/25/89       merging in Mark Rinfret's CZ1 support
  123. X    Makefile    version for CZ1
  124. X    list.c        ditto
  125. X    cz.h        MR file
  126. X    cz1.mnu        derived from MR cz1.c; removed '&' 2nd arg
  127. X            to getwaveform call; stuck in some conditionals
  128. X            for up/download file; compacted menu spec
  129. X    amigadir.c,amigadir.h,AmiAztec-make,ReadMe.CZ1
  130. X            MR files
  131. X    amigmach.c    incorporated all of MR's changes
  132. X    glib.c        must not reset 8th bit for CZ file data
  133. X    glib.1,glib.man    note MR did CZ1
  134. X4/28/89    glib.c        MR change makes nested ifdef's ok for Aztec C
  135. X    ReadMe.CZ1    MR change
  136. X    AmiAztec-make    MR update
  137. X    pc-tcc.mak    added defs for CZ1
  138. X4/30/89    menutoc.l,menutoc.c
  139. X            MR changes: subst. for strtol and remove vmin decl.
  140. X    glib.1,glib.man    rewrite
  141. X5/5/89    amigmach.c    use arp file requester, Dave Weiler, sent by Ed Wilts
  142. X    README.arp    doc on Dave Weiler's arp modification
  143. X5/7/89    [many]        tried to get rid of lint -- some is left
  144. END_OF_FILE
  145. if test 4379 -ne `wc -c <'CHANGES'`; then
  146.     echo shar: \"'CHANGES'\" unpacked with wrong size!
  147. fi
  148. # end of 'CHANGES'
  149. fi
  150. if test -f 'DX-README' -a "${1}" != "-c" ; then 
  151.   echo shar: Will not clobber existing file \"'DX-README'\"
  152. else
  153. echo shar: Extracting \"'DX-README'\" \(4285 characters\)
  154. sed "s/^X//" >'DX-README' <<'END_OF_FILE'
  155. X$Id: DX-README,v 1.6 89/05/06 17:13:05 lee Exp $
  156. XScott Snyder
  157. X$Log:    DX-README,v $
  158. X# Revision 1.6  89/05/06  17:13:05  lee
  159. X# rel. to comp.sources.misc
  160. X# 
  161. X
  162. X  This posting adds support for the Yamaha DX7 and DX7s synths to the glib
  163. Xpatch editor. The generic glib code is not included, so you'll need a copy
  164. Xof the earlier glib posting. I have only tested the code on a PC using
  165. XTurbo C V2.0; however, it shouldn't be hard to make it work in other
  166. Xenvironments. I have also sped up glib in a couple of places, in order
  167. Xto make it work tolerably fast on a PC.
  168. X
  169. X  The following files are included:
  170. X
  171. X    DX-README    this file
  172. X    dx7.mnu        DX7 synth module
  173. X    dx7s.mnu    DX7s synth module (requires dx7.mnu)
  174. X    pc-tcc.mak    makefile for Turbo C
  175. X    n001.dx7    sample DX7 bank (from Glenn Scott's DX7 patch archive)
  176. X    rom1.d7s    sample DX7s bank (downloaded from the Yamaha ROM
  177. X              cartridge)
  178. X    patches        patches to the existing glib code
  179. X
  180. X[Notes (gl): file patches is not here -- the changes are incorporated;
  181. X For the TURBO-C and the DX7 version, one must uncomment #pragma
  182. X directives in two places in file dx7.mnu.]
  183. X
  184. XCompiling the editor:
  185. X
  186. X  Mess-Dos/Turbo C: feed 'patches' into patch, rename 'pc-tcc.mak' to
  187. X    'makefile', and type 'make'. This will produce a version of glib which
  188. X    recognizes the DX7 and DX7s. To enable support for other synths, uncomment
  189. X    the appropriate lines in the makefile.
  190. X
  191. X  Other systems: feed 'patches' into patch. Then adjust your makefile
  192. X    appropriately: 'dx7.mnu' and 'dx7s.mnu' should be passed through
  193. X    menutoc and linked in with glib. glib.c and list.c should be compiled
  194. X    with the preprossesor symbols 'DX7' and 'DX7S' defined. To enable the
  195. X    faster code in glib.c, define the symbol 'SSS'.
  196. X
  197. XUsing the editors:
  198. X
  199. X    The DX7 editor works just like other glib-based editors, and shouldn't
  200. X  present any problems. However, I was unable to fit all the DX7s parameters
  201. X  on one screen, so I used a trick: some of the parameters are 'multiplexed'.
  202. X  On the DX7s screen, move the cursor to the 'Modulation Wheel' legend, then
  203. X  'increment' and 'decrement' this field: the fields below it will cycle
  204. X  through the 'Modulation Wheel', 'Aftertouch', 'Breath Control', 'Foot
  205. X  Control', and 'MIDI Control' parameters.
  206. X
  207. X    Since the DX7 banks are exactly 4096 bytes long, I chose not to add
  208. X  a DataID byte to the front, to avoid wasting disk space. glib will
  209. X  identify a DX7 bank by examining the file length. DX7 banks can be read
  210. X  in DX7s mode and vice versa; the additional DX7s data will be discarded
  211. X  or replaced with appropriate defaults.
  212. X
  213. XImplementation notes:
  214. X
  215. X    In order to draw the pictures for the DX7 algorithms, I modified the
  216. X  showstr() function to use the PC line-drawing characters. If you are
  217. X  using another system which has such special characters, you should tell
  218. X  glib about them by adding the appropriate definitions to your machdep.h
  219. X  file (see the definitions at the end of pc-mach.h for an example of
  220. X  how this should be done). If this is not done, the graphics characaters
  221. X  will be approximated (badly) by standard ASCII characters.
  222. X
  223. X    In addition to the basic cursor motion escapes (~u, ~d, ~r, ~l), showstr()
  224. X  now recognizes the following additional escapes:
  225. X
  226. X    ~| : a vertical line
  227. X    ~- : a horizontal line
  228. X    ~+ : a vertical line crossing a horizontal line
  229. X    ~T : a 'T'
  230. X    ~^ : an upside-down 'T'
  231. X    ~< : a 'T' on its right side
  232. X    ~> : a 'T' on its left side
  233. X    ~{ : the upper-left corner of a box
  234. X    ~} : the upper-right corner of a box
  235. X    ~[ : the lower-left corner of a box
  236. X    ~] : the lower-right corner of a box
  237. X    ~r : 'carriage return' - the cursor returns to the leftmost column
  238. X               it has been in in this call to showstr()
  239. X
  240. X    In addition, a repeat count can be specified with an escape in the form
  241. X  '~nc', where n is a sequence of digits and c is a character.
  242. X
  243. XCaveats:
  244. X
  245. X    Again, this code has only been tested on a PC-clone using TC V2.0.
  246. X  In addition, I don't have a Roland MPU; I tested the MIDI I/O using
  247. X  a BYTE MIDI board. The high-level interface is the same though, so it
  248. X  should work with the MPU. (By the way, if anyone is interested in BYTE
  249. X  board support for glib or the CMT, drop me a line.)
  250. X
  251. X        Scott Snyder - ssnyder@citjulie.bitnet, ssnyder@juliet.caltech.edu
  252. X            (addresses valid until mid-June)
  253. END_OF_FILE
  254. if test 4285 -ne `wc -c <'DX-README'`; then
  255.     echo shar: \"'DX-README'\" unpacked with wrong size!
  256. fi
  257. # end of 'DX-README'
  258. fi
  259. if test -f 'ctomenu.l' -a "${1}" != "-c" ; then 
  260.   echo shar: Will not clobber existing file \"'ctomenu.l'\"
  261. else
  262. echo shar: Extracting \"'ctomenu.l'\" \(5609 characters\)
  263. sed "s/^X//" >'ctomenu.l' <<'END_OF_FILE'
  264. X%{
  265. X/* $Id: ctomenu.l,v 1.6 89/05/06 17:13:13 lee Exp $
  266. X * Greg Lee, lee@uhccux.uhcc.hawaii.edu, 3/7/89
  267. X *
  268. X * Ctomenu helps translate a synthesizer-specific C file into .menu
  269. X * form by generating the '#MENU ... #END' part for the labelinfo
  270. X * array and the '#O' lines for the paraminfo array.
  271. X *
  272. X * $Log:    ctomenu.l,v $
  273. X * Revision 1.6  89/05/06  17:13:13  lee
  274. X * rel. to comp.sources.misc
  275. X * 
  276. X */
  277. X#include <string.h>
  278. X
  279. X#define SCOLS 81
  280. X#define SROWS 24
  281. X#define MAXPARAM 300
  282. X
  283. X    int i, j, offset, reservesize = 20;
  284. X    int row = -2, col = -2 , coord;
  285. X    char labelname[30];
  286. X    char paramname[30];
  287. X    char temps[30];
  288. X    char *screen;
  289. X    char paraml[MAXPARAM][30];
  290. X    char paramv[MAXPARAM][20];
  291. X    int paramcoord[MAXPARAM][6];
  292. X    int paramno = 0, pcount = 0;
  293. X    int havename = 0;
  294. X    char paramtemps[80];
  295. X    int paramtemplen;
  296. X%}
  297. X
  298. X%s A B C D E
  299. Xwh [ \t\n]*
  300. X
  301. X%%
  302. X
  303. X<A>^"#define"[ \t]+"RESERVESIZE"[ \t]*[0-9]+ {
  304. X        for (i=0; yytext[i] != 'Z'; i++) ;
  305. X        reservesize = atoi(yytext+i+2);
  306. X};
  307. X
  308. X<A>^"struct labelinfo".*\n  {
  309. X        for (i=0; i < 30 && yytext[i+16] != '{'; i++)
  310. X            labelname[i] = yytext[i+16];
  311. X        labelname[i] = 0;
  312. X        BEGIN(B);
  313. X};
  314. X
  315. X<C>^"struct paraminfo".*\n  {
  316. X        for (i=0; i < 30 && yytext[i+16] != '{'; i++)
  317. X            paramname[i] = yytext[i+16];
  318. X        paramname[i] = 0;
  319. X        havename = 0;
  320. X        BEGIN(D);
  321. X};
  322. X
  323. X<B,D>{wh}        ;
  324. X<B,D>","        ;
  325. X<D>"-1"            ;
  326. X<D>"NULL"        ;
  327. X
  328. X<B,D>[0-9]+    {
  329. X        coord = atoi(yytext);
  330. X        if (row == -2) row = coord;
  331. X        else if (col == -2) col = coord;
  332. X        else {
  333. X            fprintf(stderr, "coordinate mixup\n");
  334. X            exit(1);
  335. X        }
  336. X
  337. X        if (havename == 2 && row != -2 && col != -2) {
  338. X            strncpy(screen+(row*SCOLS)+col,paramtemps,paramtemplen);
  339. X            row = col = -2;
  340. X            havename = 0;
  341. X        }
  342. X};
  343. X
  344. X<B>\"[^\"\n]*\"  {
  345. X        if (row == -2 || col == -2) {
  346. X            fprintf(stderr, "missing coord before %s\n", yytext);
  347. X            exit(1);
  348. X        }
  349. X
  350. X        strncpy(screen+(row*SCOLS)+col, yytext+1, yyleng-2);
  351. X        row = col = -2;
  352. X};
  353. X
  354. X<D>\"[^\"\n]*\"  {
  355. X        if (!havename) {
  356. X            strncpy(paraml[paramno], yytext+1, yyleng-2);
  357. X            paraml[paramno][yyleng-2] = 0;
  358. X            havename = 1;
  359. X        } else {
  360. X            strncpy(paramtemps, yytext+1, yyleng-2);
  361. X            paramtemplen = yyleng - 2;
  362. X            havename = 2;
  363. X        }
  364. X};
  365. X
  366. X<D>"vis"[0-9A-Za-z_]+  {
  367. X        if (row == -2 || col == -2) {
  368. X            fprintf(stderr, "missing coord before %s\n", yytext);
  369. X            fprintf(stderr, "param no. %d, havename %d\n",
  370. X                paramno, havename);
  371. X            exit(1);
  372. X        }
  373. X        strncpy(paramv[paramno], yytext+3, yyleng-3);
  374. X        paramcoord[paramno][0] = row;
  375. X        paramcoord[paramno][1] = col;
  376. X        row = col = -2;
  377. X        BEGIN(E);
  378. X};
  379. X
  380. X<D>^"NULL".*\n        ;
  381. X
  382. X<E>[ \t,]        ;
  383. X
  384. X<E>[0-9]+    {
  385. X        if (pcount > 3) {
  386. X            fprintf(stderr, "extra value\n");
  387. X            exit(1);
  388. X        }
  389. X        paramcoord[paramno][2 + pcount++] = atoi(yytext);
  390. X};
  391. X
  392. X<E>\n  {
  393. X        pcount = 0;
  394. X        paramno++;
  395. X        if (paramno > MAXPARAM) {
  396. X            fprintf(stderr, "too many parameters\n");
  397. X            exit(1);
  398. X        }
  399. X        havename = 0;
  400. X        BEGIN(D);
  401. X};
  402. X
  403. X<B>.*"NULL".*\n     ;
  404. X
  405. X<B,D>^"};"  {
  406. X        BEGIN(C);
  407. X};
  408. X
  409. X<C>^[ \t]*"data[RESERVESIZE"[ \+]*[0-9]+"]"[ \t]*"="[ \t]*"getval(".*\n  {
  410. X        for (i=0; yytext[i] != '+'; i++) ;
  411. X        offset = atoi(yytext+i+1);
  412. X        while (yytext[i++] != '"')  ;
  413. X        for (j=0; yytext[i] != '"'; i++,j++)
  414. X            temps[j] = yytext[i];
  415. X        temps[j] = 0;
  416. X        for (i=0; i<paramno; i++)
  417. X            if (strcmp(temps, paraml[i]) == 0) break;
  418. X        if (i < paramno)
  419. X            paramcoord[i][5] = offset + reservesize;
  420. X        /* else error ? */
  421. X};
  422. X
  423. X
  424. X<C>^[ \t]*"data["[0-9]+"]"[ \t]*"="[ \t]*"getval(".*\n  {
  425. X        for (i=0; yytext[i] != '['; i++) ;
  426. X        offset = atoi(yytext+i+1);
  427. X        if (offset < reservesize) {
  428. X            fprintf(stderr, "offset < RESERVESIZE\n");
  429. X            exit(1);
  430. X        }
  431. X        while (yytext[i++] != '"')  ;
  432. X        for (j=0; yytext[i] != '"'; i++,j++)
  433. X            temps[j] = yytext[i];
  434. X        temps[j] = 0;
  435. X        for (i=0; i<paramno; i++)
  436. X            if (strcmp(temps, paraml[i]) == 0) break;
  437. X        if (i < paramno)
  438. X            paramcoord[i][5] = offset;
  439. X        /* else error ? */
  440. X};
  441. X
  442. X<A,C>.|\n    ;
  443. X
  444. X%%
  445. Xmain()
  446. X{    int i;
  447. X    char *s;
  448. X    char *malloc();
  449. X
  450. X    if ( (screen = malloc(SROWS * SCOLS)) == NULL) {
  451. X        fprintf(stderr, "not enough memory\n");
  452. X        exit(1);
  453. X    }
  454. X    s = screen;
  455. X    for (i=0; i < SROWS*SCOLS; i++) *s++ = ' ';
  456. X
  457. X    BEGIN(A);
  458. X    yylex();
  459. X
  460. X    printf("\n#define RESERVESIZE %d\n\n", reservesize);
  461. X    menudump();
  462. X    paramdump();
  463. X}
  464. X
  465. Xmenudump()
  466. X{    int i, j;
  467. X
  468. X    for (i=0; i<paramno; i++) {
  469. X        row = paramcoord[i][0];
  470. X        col = paramcoord[i][1];
  471. X        if (row >= SROWS || col >= SCOLS) {
  472. X            fprintf(stderr, "bad coords\n");
  473. X            exit(1);
  474. X        }
  475. X        screen[row*SCOLS + col] = '%';
  476. X    }
  477. X
  478. X    printf("struct labelinfo %s {\n", labelname);
  479. X    printf("#MENU\n");
  480. X    for (i=0; i<SROWS; i++) {
  481. X        for (j=SCOLS-1; j>=0 && screen[i*SCOLS+j] == ' '; j--)
  482. X            screen[i*SCOLS+j] = 0;
  483. X        printf("%s\n", screen+i*SCOLS);
  484. X    }
  485. X    printf("#END\n");
  486. X    printf("-1,-1,NULL\n};\n\n");
  487. X}
  488. X
  489. Xparamdump()
  490. X{    int i, j, notdone, colmin, rowmin;
  491. X    char *fmt;
  492. X
  493. X    printf("struct paraminfo %s {\n", paramname);
  494. X    printf("/*\nNAME\t\tTYPE\t\tPOS\tMAX\tOFFSET\tMASK\tSHIFT\tADHOC\n");
  495. X    printf(" */\n");
  496. X
  497. X    notdone = 1;
  498. X    while (notdone) {
  499. X        colmin = rowmin = 1000;
  500. X        for (i = 0; i < paramno; i++)
  501. X            if (paramcoord[i][0] < rowmin)
  502. X                rowmin = paramcoord[i][0];
  503. X        if (rowmin < 1000) {
  504. X            for (i = 0; i < paramno; i++)
  505. X            if (paramcoord[i][0] == rowmin) {
  506. X                if (paramcoord[i][1] < colmin) {
  507. X                    colmin = paramcoord[i][0];
  508. X                    j = i;
  509. X                }
  510. X            }
  511. X            if (colmin < 1000) {
  512. X            fmt = "#O %s\t%s\t%%%%\t%d\t%d";
  513. X            if (strlen(paraml[j]) < 5)
  514. X                fmt = "#O %s\t\t%s\t%%%%\t%d\t%d";
  515. X            if (paramcoord[j][4])
  516. X                paramcoord[j][5] = reservesize-paramcoord[j][4];
  517. X            printf(fmt,
  518. X                paraml[j], paramv[j],
  519. X                paramcoord[j][3],
  520. X                paramcoord[j][5] - reservesize);
  521. X            if (paramcoord[j][2] == 1)
  522. X                printf("\t*5");
  523. X            printf("\n");
  524. X            paramcoord[j][0] = 1000;
  525. X            paramcoord[j][1] = 1000;
  526. X            }
  527. X        } else notdone = 0;
  528. X    }
  529. X
  530. X    printf("NULL,NULL,-1,-1,-1,-1,visnum,0,0,0,0\n};\n\n");
  531. X}
  532. END_OF_FILE
  533. if test 5609 -ne `wc -c <'ctomenu.l'`; then
  534.     echo shar: \"'ctomenu.l'\" unpacked with wrong size!
  535. fi
  536. # end of 'ctomenu.l'
  537. fi
  538. if test -f 'cz.h' -a "${1}" != "-c" ; then 
  539.   echo shar: Will not clobber existing file \"'cz.h'\"
  540. else
  541. echo shar: Extracting \"'cz.h'\" \(4332 characters\)
  542. sed "s/^X//" >'cz.h' <<'END_OF_FILE'
  543. X/* $Id: cz.h,v 1.6 89/05/06 17:13:13 lee Exp $
  544. X * CZ Synthesizer Family Parameter Definitions
  545. X *
  546. X *  Filename:   cz.h
  547. X *  Date:       03/25/89, Mark R. Rinfret
  548. X * 
  549. X *
  550. X *  Note:   One of the preprocessor flags, CZ1 or CZ101, must be defined
  551. X *          by the source file including this package.
  552. X * $Log:    cz.h,v $
  553. X * Revision 1.6  89/05/06  17:13:13  lee
  554. X * rel. to comp.sources.misc
  555. X * 
  556. X */
  557. X
  558. X#ifdef CZ101
  559. X#define CZ_NAME "CZ-101"
  560. X#endif
  561. X
  562. X
  563. X#ifdef CZ1
  564. X#ifdef CZ_NAME
  565. X#include "You may not define CZ1 and CZ101 in the same compile!"
  566. X#endif
  567. X#define CZ_NAME "CZ-1"
  568. X#endif
  569. X
  570. X#ifndef CZ_NAME
  571. X#include "You MUST define either CZ1 or CZ101!"
  572. X#endif
  573. X
  574. X#ifndef UBYTE
  575. X#define UBYTE   unsigned char
  576. X#define USHORT  unsigned short
  577. X#endif
  578. X
  579. X#define ENVELOPESIZE            16      /* 8 rate/level pairs */
  580. X#define END_SYSTEM_EXCLUSIVE    0xF7
  581. X
  582. X/* MIDI note-on and note-off commands */
  583. X
  584. X#define MIDI_NOTE_ON            0x90
  585. X#define MIDI_NOTE_OFF           0x80
  586. X
  587. X#define MIDI_STATUS_MASK        0x80
  588. X
  589. X
  590. X#ifdef CZ101
  591. Xstruct ToneData {
  592. X    UBYTE lineselect_octave;
  593. X
  594. X    UBYTE detune_sign;
  595. X    UBYTE detune_fine;
  596. X    UBYTE detune_course;
  597. X
  598. X    UBYTE vibrato_wave;
  599. X    UBYTE vibrato_time[3];
  600. X    UBYTE vibrato_rate[3];
  601. X    UBYTE vibrato_depth[3];
  602. X
  603. X    UBYTE DCO1_wave_form[2];
  604. X    UBYTE DCA1_key_follow[2];
  605. X    UBYTE DCW1_key_follow[2];
  606. X    UBYTE DCA1_end_step;
  607. X    UBYTE DCA1_envelope[ENVELOPESIZE];
  608. X    UBYTE DCW1_end_step;
  609. X    UBYTE DCW1_envelope[ENVELOPESIZE];
  610. X    UBYTE DCO1_end_step;
  611. X    UBYTE DCO1_envelope[ENVELOPESIZE];
  612. X
  613. X    UBYTE DCO2_wave_form[2];
  614. X    UBYTE DCA2_key_follow[2];
  615. X    UBYTE DCW2_Key_follow[2];
  616. X    UBYTE DCA2_end_step;
  617. X    UBYTE DCA2_envelope[ENVELOPESIZE];
  618. X    UBYTE DWA2_end_step;
  619. X    UBYTE DWA2_envelope[ENVELOPESIZE];
  620. X    UBYTE DCO2_end_step;
  621. X    UBYTE DCO2_envelope[ENVELOPESIZE];
  622. X};
  623. X#endif
  624. X
  625. X#ifdef CZ1
  626. X
  627. X#define MIDI_CHANNEL_MASK       0x0f
  628. X#define MIDI_FUNCTION_MASK      0xf0
  629. X
  630. X/* Misc. MIDI status definitions */
  631. X
  632. X#define MIDI_PITCH_BEND         0xe0
  633. X
  634. X/* MIDI note-on and note-off commands */
  635. X
  636. X#define MIDI_NOTE_ON            0x90
  637. X#define MIDI_NOTE_OFF           0x80
  638. X
  639. X#define MIDI_STATUS_MASK        0x80
  640. X
  641. X#define FIRST_INTERNAL          0x00
  642. X#define LAST_INTERNAL           0x3F
  643. X#define FIRST_CARTRIDGE         0x40
  644. X#define LAST_CARTRIDGE          0x4F
  645. X#define SOUND_DATA              0x60
  646. X
  647. X/* CZ-1 Tone Data Structure.
  648. X * The only major difference between this and CZ101 is the addition of
  649. X * the "name" field.
  650. X */
  651. X
  652. Xstruct ToneData {
  653. X    UBYTE lineAndOctave;
  654. X
  655. X    UBYTE detuneSign;
  656. X    UBYTE detuneFine;
  657. X    UBYTE detuneCoarse;
  658. X
  659. X    UBYTE vibratoWave;
  660. X    UBYTE vibratoTime[3];
  661. X    UBYTE vibratoRate[3];
  662. X    UBYTE vibratoDepth[3];
  663. X
  664. X/* What follows is a very unfortunate KLUDGE!  Though we would like to
  665. X * represent the two sets of waveform data as a two-item array, the MANX
  666. X * compiler forces word alignment (somewhere), giving us a total structure
  667. X * size of 146 bytes when what we really want is 144 bytes.  ARGH!
  668. X */
  669. X
  670. X    UBYTE waveForms1[2];                  /* ugly, packed format */
  671. X
  672. X    /* NOTE: The key follow entries actually comprise a two-byte
  673. X       word but, again, the compiler won't let us do that.  The
  674. X       top 4 bits of the first byte (d) represents the level value,
  675. X       using the formula d = 15 - level. The bottom 4 bits of the
  676. X       first byte represents the "visual" key follow value, in the
  677. X       range 0 - 9.  The second byte is some magic mapping of the
  678. X       visual value to an internal value.                           */
  679. X    UBYTE DCA1_KeyFollow[2];
  680. X    UBYTE DCW1_KeyFollow[2];
  681. X    UBYTE DCA_EndStep1;                         /* DCA velocity */
  682. X    UBYTE DCA_Envelope1[ENVELOPESIZE];
  683. X    UBYTE DCW_EndStep1;                         /* DCW velocity */
  684. X    UBYTE DCW_Envelope1[ENVELOPESIZE];
  685. X    UBYTE DCO_EndStep1;                         /* DCO1 velocity */
  686. X    UBYTE DCO_Envelope1[ENVELOPESIZE];
  687. X
  688. X    UBYTE waveForms2[2];           /* slightly different than waveForms1! */
  689. X    UBYTE DCA2_KeyFollow[2];
  690. X    UBYTE DCW2_KeyFollow[2];
  691. X    UBYTE DCA_EndStep2;                         /* DCA velocity */
  692. X    UBYTE DCA_Envelope2[ENVELOPESIZE];
  693. X    UBYTE DCW_EndStep2;                         /* DCW velocity */
  694. X    UBYTE DCW_Envelope2[ENVELOPESIZE];
  695. X    UBYTE DCO_EndStep2;                         /* DCO1 velocity */
  696. X    UBYTE DCO_Envelope2[ENVELOPESIZE];
  697. X
  698. X    UBYTE name[16];
  699. X};
  700. X#endif
  701. X
  702. END_OF_FILE
  703. if test 4332 -ne `wc -c <'cz.h'`; then
  704.     echo shar: \"'cz.h'\" unpacked with wrong size!
  705. fi
  706. # end of 'cz.h'
  707. fi
  708. if test -f 'd10tva.mnu' -a "${1}" != "-c" ; then 
  709.   echo shar: Will not clobber existing file \"'d10tva.mnu'\"
  710. else
  711. echo shar: Extracting \"'d10tva.mnu'\" \(4686 characters\)
  712. sed "s/^X//" >'d10tva.mnu' <<'END_OF_FILE'
  713. X/* $Id: d10tva.mnu,v 1.6 89/05/06 17:13:18 lee Exp $
  714. X * GLIB - a Generic LIBrarian and editor for synths
  715. X *
  716. X * D10 Tone Amplifier Librarian
  717. X *
  718. X * Code started 24 JAN 89 --  Michael R. Kesti mrk@gvgspd.GVG.TEK.COM
  719. X * modified by Greg Lee
  720. X * $Log:    d10tva.mnu,v $
  721. X * Revision 1.6  89/05/06  17:13:18  lee
  722. X * rel. to comp.sources.misc
  723. X * 
  724. X */
  725. X
  726. X#include "glib.h"
  727. X#include "vis.h"
  728. X
  729. X#define D10TONSIZE 246
  730. X#define RESERVESIZE 20
  731. X
  732. Xchar *visnum();
  733. X
  734. X/* This array contains arbitrary screen labels */
  735. Xstruct labelinfo Ldtva[] = {
  736. X#MENU
  737. X
  738. X
  739. X
  740. XCOMMON                                   AMPLIFIER         1    2    3    4
  741. X-----------------                        -------------------------------------
  742. X                                            Level         %    %    %    %
  743. X   Structures       %         %             Vel Sens      %    %    %    %
  744. X   Partial Ena    %                         Bias Pnt 1    %    %    %    %
  745. X   Env Mode       %                         Bias Lev 1    %    %    %    %
  746. X                                            Bias Pnt 2    %    %    %    %
  747. X                                            Bias Lev 2    %    %    %    %
  748. X                                            Time KF       %    %    %    %
  749. X                                            Time Vel Fol  %    %    %    %
  750. X                                            Attack        %    %    %    %
  751. X                                            Decay         %    %    %    %
  752. X                                            Recover       %    %    %    %
  753. X                                            Release       %    %    %    %
  754. X                                            Attack Lev    %    %    %    %
  755. X                                            Decay Lev     %    %    %    %
  756. X                                            Sustain Lev   %    %    %    %
  757. X
  758. X
  759. X
  760. X Press SPACE BAR to sound note %   at volume %   for duration %  on channel % .
  761. X#END
  762. X-1,-1,NULL
  763. X};
  764. X
  765. Xstruct paraminfo  Pdtva[] =  {
  766. X/*
  767. XNAME        TYPE        POS    MAX    OFFSET    MASK    SHIFT    ADHOC
  768. X */
  769. X#O tva_level1        num    %%    100    55
  770. X#O tva_level2        num    %%    100    113
  771. X#O tva_level3        num    %%    100    171
  772. X#O tva_level4        num    %%    100    229
  773. X#O struct12        struct    %%    12    10
  774. X#O struct34        struct    %%    12    11
  775. X#O tva_vel_sens1    envlev    %%    100    56
  776. X#O tva_vel_sens2    envlev    %%    100    114
  777. X#O tva_vel_sens3    envlev    %%    100    172
  778. X#O tva_vel_sens4    envlev    %%    100    230
  779. X#O parmute        pmute    %%    15    12
  780. X#O tva_bias_pnt_11    biaspd    %%    127    57
  781. X#O tva_bias_pnt_12    biaspd    %%    127    115
  782. X#O tva_bias_pnt_13    biaspd    %%    127    173
  783. X#O tva_bias_pnt_14    biaspd    %%    127    231
  784. X#O envmode        envmode    %%    1    13
  785. X#O tva_bias_lev_11    tvablev    %%    12    58
  786. X#O tva_bias_lev_12    tvablev    %%    12    116
  787. X#O tva_bias_lev_13    tvablev    %%    12    174
  788. X#O tva_bias_lev_14    tvablev    %%    12    232
  789. X#O tva_bias_pnt_21    biaspd    %%    127    59
  790. X#O tva_bias_pnt_22    biaspd    %%    127    117
  791. X#O tva_bias_pnt_23    biaspd    %%    127    175
  792. X#O tva_bias_pnt_24    biaspd    %%    127    233
  793. X#O tva_bias_lev_21    tvablev    %%    12    60
  794. X#O tva_bias_lev_22    tvablev    %%    12    118
  795. X#O tva_bias_lev_23    tvablev    %%    12    176
  796. X#O tva_bias_lev_24    tvablev    %%    12    234
  797. X#O tva_time_kf1        num    %%    4    61
  798. X#O tva_time_kf2        num    %%    4    119
  799. X#O tva_time_kf3        num    %%    4    177
  800. X#O tva_time_kf4        num    %%    4    235
  801. X#O tva_time_vel_fol1    num    %%    4    62
  802. X#O tva_time_vel_fol2    num    %%    4    120
  803. X#O tva_time_vel_fol3    num    %%    4    178
  804. X#O tva_time_vel_fol4    num    %%    4    236
  805. X#O tva_attack1        num    %%    100    63
  806. X#O tva_attack2        num    %%    100    121
  807. X#O tva_attack3        num    %%    100    179
  808. X#O tva_attack4        num    %%    100    237
  809. X#O tva_decay1        num    %%    100    64
  810. X#O tva_decay2        num    %%    100    122
  811. X#O tva_decay3        num    %%    100    180
  812. X#O tva_decay4        num    %%    100    238
  813. X#O tva_recover1        num    %%    100    65
  814. X#O tva_recover2        num    %%    100    123
  815. X#O tva_recover3        num    %%    100    181
  816. X#O tva_recover4        num    %%    100    239
  817. X#O tva_release1        num    %%    100    67
  818. X#O tva_release2        num    %%    100    125
  819. X#O tva_release3        num    %%    100    183
  820. X#O tva_release4        num    %%    100    241
  821. X#O tva_attack_lev1    num    %%    100    68
  822. X#O tva_attack_lev2    num    %%    100    126
  823. X#O tva_attack_lev3    num    %%    100    184
  824. X#O tva_attack_lev4    num    %%    100    242
  825. X#O tva_decay_lev1    num    %%    100    69
  826. X#O tva_decay_lev2    num    %%    100    127
  827. X#O tva_decay_lev3    num    %%    100    185
  828. X#O tva_decay_lev4    num    %%    100    243
  829. X#O tva_sustain_lev1    num    %%    100    71
  830. X#O tva_sustain_lev2    num    %%    100    129
  831. X#O tva_sustain_lev3    num    %%    100    187
  832. X#O tva_sustain_lev4    num    %%    100    245
  833. X#O autopitch        num    %%    127    -60
  834. X#O autovol        num    %%    127    -63
  835. X#O autodur        num    %%    20    -5    *5
  836. X#O autochan        num    %%    16    -1    *5
  837. XNULL,NULL,-1,-1,-1,-1,visnum,0,0,0,0
  838. X};
  839. X
  840. X
  841. X/*
  842. X * dtvadin
  843. X *
  844. X * Take library bank 'data' and stuff values in the P array, by using
  845. X * the setval function.
  846. X */
  847. X
  848. Xdtvadin(data)
  849. Xchar *data;
  850. X{
  851. X    /* The first RESERVESIZE bytes are reserved (arbitrarily) for the voice name */
  852. X#SETVAL
  853. X}
  854. X
  855. X/*
  856. X * dtvadout
  857. X *
  858. X * Take (possibly changed) parameters values out of the P array and
  859. X * put them back into the library bank 'data'.
  860. X */
  861. X
  862. Xdtvadout(data)
  863. Xchar *data;
  864. X{
  865. X#GETVAL
  866. X}
  867. X
  868. X/* end */
  869. END_OF_FILE
  870. if test 4686 -ne `wc -c <'d10tva.mnu'`; then
  871.     echo shar: \"'d10tva.mnu'\" unpacked with wrong size!
  872. fi
  873. # end of 'd10tva.mnu'
  874. fi
  875. if test -f 'd10tvf.mnu' -a "${1}" != "-c" ; then 
  876.   echo shar: Will not clobber existing file \"'d10tvf.mnu'\"
  877. else
  878. echo shar: Extracting \"'d10tvf.mnu'\" \(4831 characters\)
  879. sed "s/^X//" >'d10tvf.mnu' <<'END_OF_FILE'
  880. X/* $Id: d10tvf.mnu,v 1.6 89/05/06 17:13:18 lee Exp $
  881. X * GLIB - a Generic LIBrarian and editor for synths
  882. X *
  883. X * D10 Tone Filter Librarian
  884. X *
  885. X * Code started 24 JAN 89 --  Michael R. Kesti mrk@gvgspd.GVG.TEK.COM
  886. X * modified by Greg Lee
  887. X * $Log:    d10tvf.mnu,v $
  888. X * Revision 1.6  89/05/06  17:13:18  lee
  889. X * rel. to comp.sources.misc
  890. X * 
  891. X */
  892. X
  893. X#include "glib.h"
  894. X#include "vis.h"
  895. X
  896. X#define D10TONSIZE 246
  897. X#define RESERVESIZE 20
  898. X
  899. Xchar *visnum();
  900. X
  901. X/* This array contains arbitrary screen labels */
  902. Xstruct labelinfo Ldtvf[] = {
  903. X#MENU
  904. X
  905. X
  906. X
  907. XCOMMON                                   FILTER            1    2    3    4
  908. X-----------------                        -------------------------------------
  909. X                                            Cutoff Freq   %    %    %    %
  910. X   Structures       %         %             Resonance     %    %    %    %
  911. X   Partial Ena    %                         Freq KF       %    %    %    %
  912. X   Env Mode       %                         Bias Pnt/Dir  %    %    %    %
  913. X                                            Bias Lev      %    %    %    %
  914. X                                            Depth         %    %    %    %
  915. X                                            Vel Sens      %    %    %    %
  916. X                                            Depth KF      %    %    %    %
  917. X                                            Time KF       %    %    %    %
  918. X                                            Attack        %    %    %    %
  919. X                                            Decay         %    %    %    %
  920. X                                            Recover       %    %    %    %
  921. X                                            Release       %    %    %    %
  922. X                                            Attack Lev    %    %    %    %
  923. X                                            Decay Lev     %    %    %    %
  924. X                                            Sustain Lev   %    %    %    %
  925. X
  926. X
  927. X Press SPACE BAR to sound note %   at volume %   for duration %  on channel % .
  928. X#END
  929. X-1,-1,NULL
  930. X};
  931. X
  932. Xstruct paraminfo  Pdtvf[] =  {
  933. X/*
  934. XNAME        TYPE        POS    MAX    OFFSET    MASK    SHIFT    ADHOC
  935. X */
  936. X#O tvf_cutoff_freq1    num    %%    100    37
  937. X#O tvf_cutoff_freq2    num    %%    100    95
  938. X#O tvf_cutoff_freq3    num    %%    100    153
  939. X#O tvf_cutoff_freq4    num    %%    100    211
  940. X#O struct12        struct    %%    12    10
  941. X#O struct34        struct    %%    12    11
  942. X#O tvf_resonance1    num    %%    30    38
  943. X#O tvf_resonance2    num    %%    30    96
  944. X#O tvf_resonance3    num    %%    30    154
  945. X#O tvf_resonance4    num    %%    30    212
  946. X#O parmute        pmute    %%    15    12
  947. X#O tvf_freq_kf1        tkeyfol    %%    14    39
  948. X#O tvf_freq_kf2        tkeyfol    %%    14    97
  949. X#O tvf_freq_kf3        tkeyfol    %%    14    155
  950. X#O tvf_freq_kf4        tkeyfol    %%    14    213
  951. X#O envmode        envmode    %%    1    13
  952. X#O tvf_bias_pntdir1    biaspd    %%    127    40
  953. X#O tvf_bias_pntdir2    biaspd    %%    127    98
  954. X#O tvf_bias_pntdir3    biaspd    %%    127    156
  955. X#O tvf_bias_pntdir4    biaspd    %%    127    214
  956. X#O tvf_bias_lev1    biaslev    %%    14    41
  957. X#O tvf_bias_lev2    biaslev    %%    14    99
  958. X#O tvf_bias_lev3    biaslev    %%    14    157
  959. X#O tvf_bias_lev4    biaslev    %%    14    215
  960. X#O tvf_depth1        num    %%    100    42
  961. X#O tvf_depth2        num    %%    100    100
  962. X#O tvf_depth3        num    %%    100    158
  963. X#O tvf_depth4        num    %%    100    216
  964. X#O tvf_vel_sens1    num    %%    100    43
  965. X#O tvf_vel_sens2    num    %%    100    101
  966. X#O tvf_vel_sens3    num    %%    100    159
  967. X#O tvf_vel_sens4    num    %%    100    217
  968. X#O tvf_depth_kf1    num    %%    4    44
  969. X#O tvf_depth_kf2    num    %%    4    102
  970. X#O tvf_depth_kf3    num    %%    4    160
  971. X#O tvf_depth_kf4    num    %%    4    218
  972. X#O tvf_time_kf1        num    %%    4    45
  973. X#O tvf_time_kf2        num    %%    4    103
  974. X#O tvf_time_kf3        num    %%    4    161
  975. X#O tvf_time_kf4        num    %%    4    219
  976. X#O tvf_attack1        num    %%    100    46
  977. X#O tvf_attack2        num    %%    100    104
  978. X#O tvf_attack3        num    %%    100    162
  979. X#O tvf_attack4        num    %%    100    219
  980. X#O tvf_decay1        num    %%    100    47
  981. X#O tvf_decay2        num    %%    100    105
  982. X#O tvf_decay3        num    %%    100    163
  983. X#O tvf_decay4        num    %%    100    220
  984. X#O tvf_recover1        num    %%    100    48
  985. X#O tvf_recover2        num    %%    100    106
  986. X#O tvf_recover3        num    %%    100    164
  987. X#O tvf_recover4        num    %%    100    221
  988. X#O tvf_release1        num    %%    100    50
  989. X#O tvf_release2        num    %%    100    108
  990. X#O tvf_release3        num    %%    100    166
  991. X#O tvf_release4        num    %%    100    223
  992. X#O tvf_attack_lev1    num    %%    100    51
  993. X#O tvf_attack_lev2    num    %%    100    109
  994. X#O tvf_attack_lev3    num    %%    100    167
  995. X#O tvf_attack_lev4    num    %%    100    224
  996. X#O tvf_decay_lev1    num    %%    100    52
  997. X#O tvf_decay_lev2    num    %%    100    110
  998. X#O tvf_decay_lev3    num    %%    100    168
  999. X#O tvf_decay_lev4    num    %%    100    225
  1000. X#O tvf_sustain_lev1    num    %%    100    54
  1001. X#O tvf_sustain_lev2    num    %%    100    112
  1002. X#O tvf_sustain_lev3    num    %%    100    170
  1003. X#O tvf_sustain_lev4    num    %%    100    227
  1004. X#O autopitch        num    %%    127    -60
  1005. X#O autovol        num    %%    127    -63
  1006. X#O autodur        num    %%    20    -5    *5
  1007. X#O autochan        num    %%    16    -1    *5
  1008. XNULL,NULL,-1,-1,-1,-1,visnum,0,0,0,0
  1009. X};
  1010. X
  1011. X
  1012. X/*
  1013. X * dtvfdin
  1014. X *
  1015. X * Take library bank 'data' and stuff values in the P array, by using
  1016. X * the setval function.
  1017. X */
  1018. X
  1019. Xdtvfdin(data)
  1020. Xchar *data;
  1021. X{
  1022. X    /* The first RESERVESIZE bytes are reserved (arbitrarily) for the voice name */
  1023. X#SETVAL
  1024. X}
  1025. X
  1026. X/*
  1027. X * dtvfdout
  1028. X *
  1029. X * Take (possibly changed) parameters values out of the P array and
  1030. X * put them back into the library bank 'data'.
  1031. X */
  1032. X
  1033. Xdtvfdout(data)
  1034. Xchar *data;
  1035. X{
  1036. X#GETVAL
  1037. X}
  1038. X
  1039. X/* end */
  1040. END_OF_FILE
  1041. if test 4831 -ne `wc -c <'d10tvf.mnu'`; then
  1042.     echo shar: \"'d10tvf.mnu'\" unpacked with wrong size!
  1043. fi
  1044. # end of 'd10tvf.mnu'
  1045. fi
  1046. if test -f 'd10wfg.mnu' -a "${1}" != "-c" ; then 
  1047.   echo shar: Will not clobber existing file \"'d10wfg.mnu'\"
  1048. else
  1049. echo shar: Extracting \"'d10wfg.mnu'\" \(5670 characters\)
  1050. sed "s/^X//" >'d10wfg.mnu' <<'END_OF_FILE'
  1051. X/* $Id: d10wfg.mnu,v 1.6 89/05/06 17:13:19 lee Exp $
  1052. X * GLIB - a Generic LIBrarian and editor for synths
  1053. X *
  1054. X * D10 Tone Waveform Generator Librarian
  1055. X *
  1056. X * Code started 24 JAN 89 --  Michael R. Kesti mrk@gvgspd.GVG.TEK.COM
  1057. X * modified by Greg Lee
  1058. X * $Log:    d10wfg.mnu,v $
  1059. X * Revision 1.6  89/05/06  17:13:19  lee
  1060. X * rel. to comp.sources.misc
  1061. X * 
  1062. X */
  1063. X
  1064. X#include "glib.h"
  1065. X#include "vis.h"
  1066. X
  1067. X#define D10TONSIZE 246
  1068. X#define RESERVESIZE 20
  1069. X
  1070. Xchar *visnum(), *visonoff();
  1071. X
  1072. X/* This array contains arbitrary screen labels */
  1073. Xstruct labelinfo Ldwfg[] = {
  1074. X
  1075. X#MENU for wfg
  1076. X
  1077. X
  1078. X
  1079. XCOMMON                                   PITCH ENV         1    2    3    4
  1080. X-----------------                        -------------------------------------
  1081. X                                            Depth      @    @    @    @ 
  1082. X   Structures       %         %            Vel Sens      @    @    @    @ 
  1083. X   Partial Ena    %                Time KF      @    @    @    @ 
  1084. X   Env Mode      %                Attack      @    @    @    @ 
  1085. X                        Decay      @    @    @    @ 
  1086. XWAVEFORM GEN      1    2    3    4        Recover      @    @    @    @ 
  1087. X-------------------------------------        Release      @    @    @    @ 
  1088. X   Coarse Pitch     %    %    %    %        Start Lev      @    @    @    @ 
  1089. X   Fine Pitch    %    %    %    %        Attack Lev      @    @    @    @ 
  1090. X   Pitch KF     %    %    %    %        Decay Lev      @    @    @    @ 
  1091. X   Bend Switch     %    %    %    %        End Lev      @    @    @    @ 
  1092. X   Wave/PCMBank     %    %    %    %        LFO Rate      @    @    @    @ 
  1093. X   PCM Number     %    %    %    %        LFO Depth      @    @    @    @ 
  1094. X   Pulse Width     %    %    %    %        Mod Sens      @    @    @    @ 
  1095. X   PW Vel Sens     %    %    %    %
  1096. X
  1097. X
  1098. X
  1099. X Press SPACE BAR to sound note @   at volume @   for duration @  on channel @ .
  1100. X#END wfg menu
  1101. X
  1102. X-1,-1,NULL
  1103. X};
  1104. X
  1105. Xstruct paraminfo Pdwfg[] = {
  1106. X
  1107. X/*NAME            TYPE        POS    MAX    OFFSET MASK SHIFT ADHOC
  1108. X*/
  1109. X
  1110. X#O struct12        struct        %%    12    10
  1111. X#O struct34        struct        %%    12    11
  1112. X#O parmute        pmute        %%    15    12
  1113. X#O envmode        envmode        %%    1    13
  1114. X
  1115. X#O wg_coarse_pitch1    cpitch        %%    96    14
  1116. X#O wg_coarse_pitch2    cpitch        %%    96    72
  1117. X#O wg_coarse_pitch3    cpitch        %%    96    130
  1118. X#O wg_coarse_pitch4    cpitch        %%    96    188
  1119. X#O wg_fine_pitch1    finetune    %%    100    15
  1120. X#O wg_fine_pitch2    finetune    %%    100    73
  1121. X#O wg_fine_pitch3    finetune    %%    100    131
  1122. X#O wg_fine_pitch4    finetune    %%    100    189
  1123. X#O wg_pitch_kf1        pkeyfol        %%    16    16
  1124. X#O wg_pitch_kf2        pkeyfol        %%    16    74
  1125. X#O wg_pitch_kf3        pkeyfol        %%    16    132
  1126. X#O wg_pitch_kf4        pkeyfol        %%    16    190
  1127. X#O wg_bend_switch1    onoff        %%    1    17
  1128. X#O wg_bend_switch2    onoff        %%    1    75
  1129. X#O wg_bend_switch3    onoff        %%    1    133
  1130. X#O wg_bend_switch4    onoff        %%    1    191
  1131. X#O wg_wave_bank1    wavebank    %%    3    18
  1132. X#O wg_wave_bank2    wavebank    %%    3    76
  1133. X#O wg_wave_bank3    wavebank    %%    3    134
  1134. X#O wg_wave_bank4    wavebank    %%    3    192
  1135. X#O wg_pcm_number1    pcmnum        %%    127    19
  1136. X#O wg_pcm_number2    pcmnum        %%    127    77
  1137. X#O wg_pcm_number3    pcmnum        %%    127    135
  1138. X#O wg_pcm_number4    pcmnum        %%    127    193
  1139. X#O wg_pulse_width1    num        %%    100    20
  1140. X#O wg_pulse_width2    num        %%    100    78
  1141. X#O wg_pulse_width3    num        %%    100    136
  1142. X#O wg_pulse_width4    num        %%    100    194
  1143. X#O wg_pw_vel_sens1    velsens        %%    14    21
  1144. X#O wg_pw_vel_sens2    velsens        %%    14    79
  1145. X#O wg_pw_vel_sens3    velsens        %%    14    137
  1146. X#O wg_pw_vel_sens4    velsens        %%    14    195
  1147. X
  1148. X#O penv_depth1        num        @@    10    22
  1149. X#O penv_depth2        num        @@    10    80
  1150. X#O penv_depth3        num        @@    10    138
  1151. X#O penv_depth4        num        @@    10    196
  1152. X#O penv_vel_sens1    num        @@    3    23
  1153. X#O penv_vel_sens2    num        @@    3    81
  1154. X#O penv_vel_sens3    num        @@    3    139
  1155. X#O penv_vel_sens4    num        @@    3    197
  1156. X#O penv_time_kf1    num        @@    4    24
  1157. X#O penv_time_kf2    num        @@    4    82
  1158. X#O penv_time_kf3    num        @@    4    140
  1159. X#O penv_time_kf4    num        @@    4    198
  1160. X#O penv_attack1        num        @@    100    25
  1161. X#O penv_attack2        num        @@    100    83
  1162. X#O penv_attack3        num        @@    100    141
  1163. X#O penv_attack4        num        @@    100    199
  1164. X#O penv_decay1        num        @@    100    26
  1165. X#O penv_decay2        num        @@    100    83
  1166. X#O penv_decay3        num        @@    100    142
  1167. X#O penv_decay4        num        @@    100    200
  1168. X#O penv_recover1    num        @@    100    27
  1169. X#O penv_recover2    num        @@    100    85
  1170. X#O penv_recover3    num        @@    100    143
  1171. X#O penv_recover4    num        @@    100    201
  1172. X#O penv_release1    num        @@    100    28
  1173. X#O penv_release2    num        @@    100    86
  1174. X#O penv_release3    num        @@    100    144
  1175. X#O penv_release4    num        @@    100    202
  1176. X#O penv_start_lev1    envlev        @@    100    29
  1177. X#O penv_start_lev2    envlev        @@    100    87
  1178. X#O penv_start_lev3    envlev        @@    100    145
  1179. X#O penv_start_lev4    envlev        @@    100    203
  1180. X#O penv_attack_lev1    envlev        @@    100    30
  1181. X#O penv_attack_lev2    envlev        @@    100    88
  1182. X#O penv_attack_lev3    envlev        @@    100    146
  1183. X#O penv_attack_lev4    envlev        @@    100    206
  1184. X#O penv_decay_lev1    envlev        @@    100    31
  1185. X#O penv_decay_lev2    envlev        @@    100    89
  1186. X#O penv_decay_lev3    envlev        @@    100    147
  1187. X#O penv_decay_lev4    envlev        @@    100    205
  1188. X
  1189. X#O penv_end_lev1    envlev        @@    100    33
  1190. X#O penv_end_lev2    envlev        @@    100    91
  1191. X#O penv_end_lev3    envlev        @@    100    149
  1192. X#O penv_end_lev4    envlev        @@    100    207
  1193. X#O penv_lfo_rate1    num        @@    100    34
  1194. X#O penv_lfo_rate2    num        @@    100    92
  1195. X#O penv_lfo_rate3    num        @@    100    150
  1196. X#O penv_lfo_rate4    num        @@    100    208
  1197. X#O penv_lfo_depth1    num        @@    100    35
  1198. X#O penv_lfo_depth2    num        @@    100    93
  1199. X#O penv_lfo_depth3    num        @@    100    151
  1200. X#O penv_lfo_depth4    num        @@    100    209
  1201. X#O penv_mod_sens1    num        @@    100    36
  1202. X#O penv_mod_sens2    num        @@    100    94
  1203. X#O penv_mod_sens3    num        @@    100    152
  1204. X#O penv_mod_sens4    num        @@    100    210
  1205. X
  1206. X
  1207. X"autopitch",    NULL,    -1,-1, @@, visnum,     0, 127, 60, 0,
  1208. X"autovol",    NULL,    -1,-1, @@, visnum,     0, 127, 63, 0,
  1209. X"autodur",    NULL,    -1,-1, @@, visnum,     1,  20,  5, 0,
  1210. X"autochan",    NULL,    -1,-1, @@, visnum,     1,  16,  1, 0,
  1211. X
  1212. XNULL,        NULL,    -1,-1, -1, -1, visnum,     0,   0, 0, 0
  1213. X};
  1214. X
  1215. X
  1216. X/*
  1217. X * dwfgdin
  1218. X *
  1219. X * Take library bank 'data' and stuff values in the P array, by using
  1220. X * the setval function.
  1221. X */
  1222. X
  1223. Xdwfgdin(data)
  1224. Xchar *data;
  1225. X{
  1226. X    /* The first RESERVESIZE bytes are reserved (arbitrarily) for the voice name */
  1227. X#SETVAL
  1228. X}
  1229. X
  1230. X/*
  1231. X * dwfgdout
  1232. X *
  1233. X * Take (possibly changed) parameters values out of the P array and
  1234. X * put them back into the library bank 'data'.
  1235. X */
  1236. X
  1237. Xdwfgdout(data)
  1238. Xchar *data;
  1239. X{
  1240. X#GETVAL
  1241. X}
  1242. X
  1243. X/* end */
  1244. END_OF_FILE
  1245. if test 5670 -ne `wc -c <'d10wfg.mnu'`; then
  1246.     echo shar: \"'d10wfg.mnu'\" unpacked with wrong size!
  1247. fi
  1248. # end of 'd10wfg.mnu'
  1249. fi
  1250. if test -f 'k1single.mnu' -a "${1}" != "-c" ; then 
  1251.   echo shar: Will not clobber existing file \"'k1single.mnu'\"
  1252. else
  1253. echo shar: Extracting \"'k1single.mnu'\" \(4279 characters\)
  1254. sed "s/^X//" >'k1single.mnu' <<'END_OF_FILE'
  1255. X/* $Id: k1single.mnu,v 1.6 89/05/06 17:13:28 lee Exp $
  1256. X * GLIB - a Generic LIBrarian and editor for synths
  1257. X *
  1258. X * K1 Tone Waveform Generator Librarian
  1259. X *
  1260. X * Adapted for K1 from Kesti's D10 version by Greg Lee
  1261. X * $Log:    k1single.mnu,v $
  1262. X * Revision 1.6  89/05/06  17:13:28  lee
  1263. X * rel. to comp.sources.misc
  1264. X * 
  1265. X */
  1266. X
  1267. X#include "glib.h"
  1268. X#include "k1vis.h"
  1269. X
  1270. X#define RESERVESIZE 0
  1271. X
  1272. X/* This array contains arbitrary screen labels */
  1273. Xstruct labelinfo Lk1sng[] = {
  1274. X
  1275. X#MENU for single
  1276. X            volume  %
  1277. X                     WAVE
  1278. X                     ---mute--select------------------am--
  1279. XCOMMON                                   1  @     @
  1280. X-----------------                        2  @      @              @
  1281. X source       %    a.bend time   %       3  @     @
  1282. X vibr depth   %    a.bend vel>dp %     4  @     @              @
  1283. X vibr speed   %    a.bend ks>tm  %
  1284. X vibr shape   %    prs->freq     %     ENVELOPE       1    2    3    4
  1285. X prs->depth   %    pitch bend    %     -------------------------------------
  1286. X vibr wheel   %    ks curve     %        level      @    @    @    @
  1287. X a.bend depth %    poly mode     %        delay      @    @    @    @
  1288. X                        attack      @    @    @    @
  1289. XFREQUENCY         1    2    3    4        decay      @    @    @    @ 
  1290. X-------------------------------------        sustain      @    @    @    @ 
  1291. X   key track        %    %    %    %        release      @    @    @    @
  1292. X   fcoarse/fixk  %    %    %    %        vel curve      @    @    @    @
  1293. X   fine pitch     %    %    %    %        level mod vel @    @    @    @
  1294. X   fm vib/a.bend %    %    %    %        level mod prs @    @    @    @ 
  1295. X   fm md prs>fq  %    %    %    %        level mod ks  @    @    @    @ 
  1296. X   ks->freq        %    %    %    %        time mod vel  @    @    @    @ 
  1297. X                        time mod ks      @    @    @    @ 
  1298. X
  1299. X Press SPACE BAR to sound note @   at volume @   for duration @  on channel @ .
  1300. X#END single menu
  1301. X
  1302. X-1,-1,NULL
  1303. X};
  1304. X
  1305. Xstruct paraminfo Pk1sng[] = {
  1306. X
  1307. X/*NAME        TYPE        POS    MAX    OFFSET    MASK    SHIFT    ADHOC*/
  1308. X#O volume    pnum        %%    99    10
  1309. X
  1310. X#O src_24    twofour        %%    1    11    0x4    2
  1311. X#O ab_tim    num        %%    100    19
  1312. X#O vb_dep    finetune    %%    100    13
  1313. X#O abveld    finetune    %%    100    20
  1314. X#O ifo_sp    num        %%    100    16
  1315. X#O abksti    finetune    %%    100    21
  1316. X#O ifo_sh    ifosh        %%    3    17    0x3
  1317. X#O prs_fq    finetune    %%    100    12
  1318. X#O vb_prs    finetune    %%    100    14
  1319. X#O p_bend    num        %%    12    15
  1320. X#O vb_whl    vbwh        %%    1    17    0x60    5
  1321. X#O ks_crv    crv        %%    4    17    0x1C    2
  1322. X#O ab_dep    finetune    %%    100    18
  1323. X#O poly_m    polym        %%    2    11    0x3
  1324. X
  1325. X#O ky_tk1    onoffk1        %%    1    35    0x2    1
  1326. X#O ky_tk2    onoffk2        %%    1    36    0x2    1
  1327. X#O ky_tk3    onoffk3        %%    1    37    0x2    1
  1328. X#O ky_tk4    onoffk4        %%    1    38    0x2    1
  1329. X#O csfn1    csfnk1        %%    127    27
  1330. X#O csfn2    csfnk2        %%    127    28
  1331. X#O csfn3    csfnk3        %%    127    29
  1332. X#O csfn4    csfnk4        %%    127    30
  1333. X#O 4fine    finetune    %%    100    23
  1334. X#O vb_ab1    onoff        %%    1    35    0x4    2
  1335. X#O vb_ab2    onoff        %%    1    36    0x4    2
  1336. X#O vb_ab3    onoff        %%    1    37    0x4    2
  1337. X#O vb_ab4    onoff        %%    1    38    0x4    2
  1338. X#O prsfq1    onoff        %%    1    35    0x8    3
  1339. X#O prsfq2    onoff        %%    1    36    0x8    3
  1340. X#O prsfq3    onoff        %%    1    37    0x8    3
  1341. X#O prsfq4    onoff        %%    1    38    0x8    3
  1342. X#O 4fksfq    finetune    %%    100    83
  1343. X
  1344. X#O s1mute    mute        @@    1    22    0x1
  1345. X#O wave1    wave        @@    255    31            *3
  1346. X#O wvmsb1    num        --    1    35    0x1        *4
  1347. X#O s2mute    mute        @@    1    22    0x2    1
  1348. X#O wave2    wave        @@    255    32            *3
  1349. X#O wvmsb2    num        --    1    36    0x1        *4
  1350. X#O am_12    am1        @@    2    11    0x18    3
  1351. X#O s3mute    mute        @@    1    22    0x4    2
  1352. X#O wave3    wave        @@    255    33            *3
  1353. X#O wvmsb3    num        --    1    37    0x1        *4
  1354. X#O s4mute    mute        @@    1    22    0x8    3
  1355. X#O wave4    wave        @@    255    34            *3
  1356. X#O wvmsb4    num        --    1    38    0x1        *4
  1357. X#O am_34    am3        @@    2    11    0x60    5
  1358. X
  1359. X#O 4envlv    num        @@    100    39
  1360. X#O 4envdl    num        @@    100    43
  1361. X#O 4envat    num        @@    100    47
  1362. X#O 4envdc    num        @@    100    51
  1363. X#O 4envsu    num        @@    100    55
  1364. X#O 4envre    num        @@    100    59
  1365. X#O vlcrv1    pnum        @@    7    35    0x70    4
  1366. X#O vlcrv2    pnum        @@    7    36    0x70    4
  1367. X#O vlcrv3    pnum        @@    7    37    0x70    4
  1368. X#O vlcrv4    pnum        @@    7    38    0x70    4
  1369. X#O 4lmvel    finetune    @@    100    63
  1370. X#O 4lmprs    finetune    @@    100    67
  1371. X#O 4lm_ks    finetune    @@    100    71
  1372. X#O 4tmvel    finetune    @@    100    75
  1373. X#O 4tm_ks    finetune    @@    100    79
  1374. X
  1375. X"autopitch",    NULL,    -1,-1, @@, visnum,     0, 127, 60, 0,
  1376. X"autovol",    NULL,    -1,-1, @@, visnum,     0, 127, 63, 0,
  1377. X"autodur",    NULL,    -1,-1, @@, visnum,     1,  20,  5, 0,
  1378. X"autochan",    NULL,    -1,-1, @@, visnum,     1,  16,  1, 0,
  1379. X
  1380. XNULL,        NULL,    -1,-1, -1, -1, visnum,     0,   0, 0, 0
  1381. X};
  1382. X
  1383. X
  1384. X/*
  1385. X * k1sdin
  1386. X *
  1387. X * Take library bank 'data' and stuff values in the P array, by using
  1388. X * the setval function.
  1389. X */
  1390. X
  1391. Xk1sdin(data)
  1392. Xchar *data;
  1393. X{
  1394. X#SETVAL
  1395. X}
  1396. X
  1397. X/*
  1398. X * k1sdout
  1399. X *
  1400. X * Take (possibly changed) parameters values out of the P array and
  1401. X * put them back into the library bank 'data'.
  1402. X */
  1403. X
  1404. Xk1sdout(data)
  1405. Xchar *data;
  1406. X{
  1407. X#GETVAL
  1408. X}
  1409. X
  1410. X/* end */
  1411. END_OF_FILE
  1412. if test 4279 -ne `wc -c <'k1single.mnu'`; then
  1413.     echo shar: \"'k1single.mnu'\" unpacked with wrong size!
  1414. fi
  1415. # end of 'k1single.mnu'
  1416. fi
  1417. if test -f 'pc-mach.h' -a "${1}" != "-c" ; then 
  1418.   echo shar: Will not clobber existing file \"'pc-mach.h'\"
  1419. else
  1420. echo shar: Extracting \"'pc-mach.h'\" \(4748 characters\)
  1421. sed "s/^X//" >'pc-mach.h' <<'END_OF_FILE'
  1422. X/* $Id: pc-mach.h,v 1.6 89/05/06 17:13:40 lee Exp $
  1423. X *
  1424. X * Machine-dependent stuff for DOS.  Has only been tested with Turbo C 2.0.
  1425. X * $Log:    pc-mach.h,v $
  1426. X * Revision 1.6  89/05/06  17:13:40  lee
  1427. X * rel. to comp.sources.misc
  1428. X * 
  1429. X */
  1430. X
  1431. X#include <dos.h>
  1432. X#include <dir.h>
  1433. X#include <stdio.h>
  1434. X#include <ctype.h>
  1435. X#include <fcntl.h>
  1436. X#include <errno.h>
  1437. X#include <sys/stat.h>
  1438. X
  1439. X#define TURBOC
  1440. X
  1441. X#define MIDIABLE
  1442. X
  1443. X#define OPENBINFILE(f,name,mode) f=fopen(name,mode[0]=='r'?"rb":"wb")
  1444. X#define OPENTEXTFILE(f,name,mode) f=fopen(name,mode[0]=='r'?"rt":"wt")
  1445. X
  1446. Xextern unsigned long hzcount;
  1447. Xextern int wrt_index, rd_index;
  1448. Xextern int Nextpcchar;
  1449. X
  1450. X#define INT16 int
  1451. X
  1452. X#define STATMIDI (wrt_index==rd_index?0:1)
  1453. X#define STATCONSOLE (Nextpcchar!=EOF?1:(kbhit()?(Nextpcchar=getch(),1):0))
  1454. X#define RTSTART rtstart()
  1455. X#define RTEND rtend()
  1456. X#define KEYCHECK keycheck()
  1457. X#define TTYISRAW
  1458. X#define NEEDSECHO
  1459. X
  1460. X#define SEPARATOR "\\"
  1461. X#define CORELEFT coreleft
  1462. X/* fake ones for a fake signal() */
  1463. X#define SIGINT 1
  1464. X#define SIG_IGN 0
  1465. X
  1466. X/* CLOCK DEFINES */
  1467. X
  1468. X#define MASTER_CLOCK_RATE    96        /* 96 CLOCKS PER BEAT */
  1469. X#define MIDI_CLOCKS_PER_BEAT    24
  1470. X
  1471. X/* MISC INTERNAL DEFINES */
  1472. X
  1473. X#define REC_CTRL_ALL      1
  1474. X#define REC_CTRL_NO_BEND  0    
  1475. X#define REC_CTRL_NO_PRESS 2
  1476. X
  1477. X#define COMMAND_MSG     0
  1478. X#define READ_MSG     1
  1479. X#define WRITE_MSG    2
  1480. X
  1481. X#define SHELL_USE_INTERNAL_CLOCK 0
  1482. X#define SHELL_USE_TAPE_CLOCK 1
  1483. X#define SHELL_USE_MIDI_CLOCK 2
  1484. X
  1485. X/* CODES FOR THE COMMANDS THAT ARE SENT TO THE MIC */
  1486. X
  1487. X#define PLAY_STOP        0x05
  1488. X#define PLAY_START        0x0A
  1489. X#define REC_STOP        0x11
  1490. X#define OVERDUB_STOP        0x15
  1491. X#define RECORD_STANDBY        0x20
  1492. X#define REC_START        0x22
  1493. X#define OVERDUB_START        0x2A
  1494. X#define NO_ALL_NOTES_OFF    0x30
  1495. X#define NO_REAL_TIME        0x32
  1496. X#define THRU_DEAD        0x33
  1497. X#define COMMON_TO_HOST        0x38
  1498. X#define REAL_TIME_IN        0x39
  1499. X#define UART            0x3f
  1500. X#define SET_REFA        0x40
  1501. X#define USE_INTERNAL_CLOCK    0x80
  1502. X#define USE_TAPE_CLOCK        0x81
  1503. X#define USE_MIDI_CLOCK        0x82
  1504. X#define METRONOME_ON_NORMAL    0x83
  1505. X#define METRONOME_OFF        0x84
  1506. X#define METRONOME_ON_DOUBLE    0x85
  1507. X#define BENDER_OFF        0x86
  1508. X#define BENDER_ON        0x87
  1509. X#define THRU_OFF         0x88
  1510. X#define THRU_ON            0x89
  1511. X#define INHIBIT_MEASURE_END    0x8C
  1512. X#define REQUEST_MEASURE_END    0x8D
  1513. X#define CONDUCTOR_OFF        0x8e
  1514. X#define CONDUCTOR_ON        0x8f
  1515. X#define RTM_AFFECT_OFF        0x90
  1516. X#define RTM_AFFECT_ON        0x91
  1517. X#define FSK_TO_INT        0x92
  1518. X#define FSK_TO_MIDI        0x93
  1519. X#define CLOCK_TO_HOST_OFF    0x94
  1520. X#define CLOCK_TO_HOST_ON    0x95
  1521. X#define CREFA_OFF        0x98
  1522. X#define READ_RESET_RECORD_CTR    0xAB
  1523. X#define TEMPO_REQUEST        0xAF
  1524. X#define CLEAR_PLAY_COUNTERS    0xB8
  1525. X#define CLEAR_PLY        0xb9
  1526. X#define SET_CLOCK_RES        0xc2
  1527. X#define SEND_DATA        (0xd0 + 7)    /* send on track 7 */
  1528. X#define SEND_SYSTEM        0xdf
  1529. X#define SET_TEMPO        0xE0
  1530. X#define CLOCKS_PER_BEAT        0xE4
  1531. X#define BEATS_PER_MEASURE    0xE6
  1532. X#define CLOCK_TO_HOST_RATE    0xe7
  1533. X#define ACTIVE_TRACKS        0xEC
  1534. X#define ACCEPT_CHANNELS_LOW    0xEE
  1535. X#define ACCEPT_CHANNELS_HIGH    0xEF
  1536. X#define TIMING_OVERFLOW        0xF8
  1537. X#define SEND_NULL        0xF8
  1538. X#define MEASURE_END        0xf9
  1539. X#define DATA_END        0xfc
  1540. X#define RESET            0xFF
  1541. X
  1542. X/* CODES FOR THE MESSAGES THAT ARE READ FROM THE MIC */
  1543. X
  1544. X#define REQUEST_PLAY_DATA    0xF0
  1545. X#define TIMING_OVERFLOW        0xF8
  1546. X#define DATA_END_MARK        0xFC
  1547. X#define ALL_END            0xFC
  1548. X/* #define MEASURE_END        0xF9  avoid redefinition */
  1549. X#define CONDUCT_REQ        0xf9
  1550. X#define CLOCK_TO_HOST        0xFD
  1551. X#define ACK            0Xfe
  1552. X#define SYSTEM_MSG        0xff
  1553. X
  1554. X/* HARDWARE LEVEL ACCESS TO THE MIC, FROM 'C' */
  1555. X
  1556. X#define BASE_ADDRESS_MIC    0X0330
  1557. X#define STATUS_PORT_MIC        BASE_ADDRESS_MIC + 1
  1558. X#define COMMAND_PORT_MIC    BASE_ADDRESS_MIC + 1
  1559. X#define DATA_OUT_PORT_MIC    BASE_ADDRESS_MIC + 0
  1560. X#define DATA_IN_PORT_MIC    BASE_ADDRESS_MIC + 0
  1561. X#define INT_MIC            2
  1562. X#define INT2             10
  1563. X#define DATA_READY_MIC_MASK    0x40
  1564. X#define DATA_AVAILABLE_MIC_MASK 0x80
  1565. X#define INT_RESET_PORT        0x20
  1566. X#define INT_RESET_CODE        0x20
  1567. X#define PC_INTERRUPT_MASK_REGISTER 0x21
  1568. X
  1569. X
  1570. X/* INPUT/OUTPUT LOW LEVEL MACROS */
  1571. X
  1572. X#define NOT_READY_FOR_DATA_MIC() (inportb(STATUS_PORT_MIC) & \
  1573. X                    DATA_READY_MIC_MASK)
  1574. X#define NOT_DATA_AVAILABLE_MIC() (inportb(STATUS_PORT_MIC) & \
  1575. X                    DATA_AVAILABLE_MIC_MASK)
  1576. X#define COMMAND_OUT_MIC(com)     outportb(COMMAND_PORT_MIC, com)
  1577. X#define DATA_OUT_MIC(dat)     outportb(DATA_OUT_PORT_MIC, dat)
  1578. X#define READ_DATA_MIC()     inportb(DATA_IN_PORT_MIC)
  1579. X
  1580. X/* define the graphics drawing characters for showstr */
  1581. X
  1582. X#define DRAW_VERT    179    /* vertical line */
  1583. X#define DRAW_HORIZ    196    /* horizontal line */
  1584. X#define DRAW_CROSS    197    /* vertical line intersecting horizontal */
  1585. X#define DRAW_UPTEE    194    /* 'T' */
  1586. X#define DRAW_DOWNTEE    193    /* upside-down 'T' */
  1587. X#define DRAW_LEFTTEE    195    /* 'T' on its left side */
  1588. X#define DRAW_RIGHTTEE    180    /* 'T' on its right side */
  1589. X#define DRAW_UPLEFT    218    /* upper-left corner */
  1590. X#define DRAW_UPRIGHT    191    /* upper-right corner */
  1591. X#define DRAW_DOWNLEFT    192    /* lower-left corner */
  1592. X#define DRAW_DOWNRIGHT    217    /* lower-right corner */
  1593. END_OF_FILE
  1594. if test 4748 -ne `wc -c <'pc-mach.h'`; then
  1595.     echo shar: \"'pc-mach.h'\" unpacked with wrong size!
  1596. fi
  1597. # end of 'pc-mach.h'
  1598. fi
  1599. if test -f 'st-mach.c' -a "${1}" != "-c" ; then 
  1600.   echo shar: Will not clobber existing file \"'st-mach.c'\"
  1601. else
  1602. echo shar: Extracting \"'st-mach.c'\" \(5590 characters\)
  1603. sed "s/^X//" >'st-mach.c' <<'END_OF_FILE'
  1604. X/* $Id: st-mach.c,v 1.6 89/05/06 17:13:42 lee Exp $
  1605. X *
  1606. X * GLIB - a Generic LIBrarian and editor for synths
  1607. X *
  1608. X * Machine dependent stuff.
  1609. X *
  1610. X */
  1611. X
  1612. X#include "glib.h"
  1613. X#include <ctype.h>
  1614. X
  1615. Xint Rows, Cols;
  1616. X
  1617. X#define EscSeq(x) Cconout('\033');Cconout(x);
  1618. Xstruct iorecinfo {
  1619. X    char *ibuf;
  1620. X    int ibufsiz;
  1621. X    int ibufhd;
  1622. X    int ibuftl;
  1623. X    int ibuflow;
  1624. X    int ibufhigh;
  1625. X};
  1626. X#define MIDIBUFSIZE 5000
  1627. Xchar *Origbuf;
  1628. Xint Origsize;
  1629. Xstruct iorecinfo *Ioptr;
  1630. Xint work_in[12], work_out[60];  /* GEM & VDI stuff */
  1631. Xint intin[128], ptsin[128];
  1632. Xint intout[128], ptsout[128];
  1633. Xint contrl[12];
  1634. Xint Handle, Vhandle;
  1635. X
  1636. X/* These contain the raw voice data */
  1637. Xhello()
  1638. X{
  1639. X    int dummy, n;
  1640. X
  1641. X    appl_init();
  1642. X
  1643. X    /* Get the Midi Iorec and put in a bigger buffer */
  1644. X    flushmidi();
  1645. X    Ioptr = (struct iorecinfo *)(Iorec(2));
  1646. X    Origbuf = Ioptr->ibuf;
  1647. X    Origsize = Ioptr->ibufsiz;
  1648. X    Ioptr->ibuf = alloc(MIDIBUFSIZ);
  1649. X    Ioptr->ibufsiz = MIDIBUFSIZ;
  1650. X    Ioptr->ibuftl = Ioptr->ibufhd = 0;
  1651. X    Cursconf(2,0);        /* set non-blinking block cursor */
  1652. X    mouseon();
  1653. X}
  1654. X
  1655. Xbye()
  1656. X{
  1657. X    /* Restore the original Midi Iorec buffer */
  1658. X    flushmidi();
  1659. X    Ioptr->ibuf = Origbuf;
  1660. X    Ioptr->ibufsiz = Origsize;
  1661. X    Ioptr->ibuftl = Ioptr->ibufhd = 0;
  1662. X    mouseoff();
  1663. X    appl_exit();
  1664. X
  1665. X    /* are these ever called? SAF */
  1666. X    windgoto(23,0);
  1667. X    windrefresh();
  1668. X    windexit(0);
  1669. X}
  1670. X
  1671. X/* getmouse - get currect row and column of mouse */
  1672. Xgetmouse(amr,amc)
  1673. Xint *amr;
  1674. Xint *amc;
  1675. X{
  1676. X#ifdef USEMOUSE
  1677. X    int button, ret, keycode, tmp1, tmp2;
  1678. X    char msgbuf[8];
  1679. X
  1680. X    graf_mkstate(amc,amr,&tmp1,&tmp2);
  1681. X    /* evnt_multi(MU_TIMER,
  1682. X        0,0,0,
  1683. X        0,0,0,0,0,
  1684. X        0,0,0,0,0,
  1685. X        msgbuf, 0, 0,
  1686. X        amc, amr, &button, &ret, &keycode, &ret); */
  1687. X    /* convert bitmap x,y coordinates to row,colum */
  1688. X    *amr = (*amr)/16;
  1689. X    *amc = (*amc)/8;
  1690. X#else
  1691. X    *amr = -1;
  1692. X    *amc = -1;
  1693. X#endif
  1694. X}
  1695. X
  1696. X/* statmouse - return mouse button state (0=nothing pressed,1=left,2=right) */
  1697. Xstatmouse()
  1698. X{
  1699. X#ifdef USEMOUSE
  1700. X    int tmp1, tmp2, tmp3, buttons;
  1701. X    char msgbuf[8];
  1702. X
  1703. X    graf_mkstate(&tmp1,&tmp2,&buttons,&tmp3);
  1704. X    /* evnt_multi(MU_TIMER,
  1705. X        0,0,0,
  1706. X        0,0,0,0,0,
  1707. X        0,0,0,0,0,
  1708. X        msgbuf, 0, 0,
  1709. X        &tmp1, &tmp1, &buttons, &tmp1, &tmp1, &tmp1); */
  1710. X    return(buttons);
  1711. X#else
  1712. X    return(-1);
  1713. X#endif
  1714. X}
  1715. X
  1716. Xint Mouseshown = 0;
  1717. Xmouseon()
  1718. X{
  1719. X#ifdef USEMOUSE
  1720. X    if ( Mouseshown == 0 ) {
  1721. X        Vsync();    /* wait until next VBI to ensure updating */
  1722. X        Cursconf(1,0);        /* show block cursor */
  1723. X        Vsync();    /* wait until next VBI to ensure updating */
  1724. X        graf_mouse(257,NULL);    /* display mouse cursor */
  1725. X        Mouseshown = 1;
  1726. X        Vsync();
  1727. X    }
  1728. X#endif
  1729. X}
  1730. Xmouseoff()
  1731. X{
  1732. X#ifdef USEMOUSE
  1733. X    if ( Mouseshown == 1 ) {
  1734. X        Vsync();    /* wait until next VBI to ensure updating */
  1735. X        graf_mouse(256,NULL);    /* hide mouse cursor */
  1736. X        Vsync();    /* wait until next VBI to ensure updating */
  1737. X        Cursconf(0,0);        /* hide block cursor */
  1738. X        Mouseshown = 0;
  1739. X        Vsync();
  1740. X    }
  1741. X#endif
  1742. X}
  1743. X
  1744. X/* Return when either a console key or mouse button is pressed. */
  1745. Xmouseorkey()
  1746. X{
  1747. X#ifdef USEMOUSE
  1748. X    int evnt, ret, keycode, button, mx, my, tmp1, tmp2, tmp3;
  1749. X    char msgbuf[8];
  1750. X
  1751. X    mouseon();
  1752. X    for ( ;; ) {
  1753. X        graf_mkstate(&tmp1,&tmp2,&button,&tmp3);
  1754. X        /* evnt = evnt_multi(MU_TIMER,
  1755. X            0,0,0,
  1756. X            0,0,0,0,0,
  1757. X            0,0,0,0,0,
  1758. X            msgbuf, 0, 0,
  1759. X            &mx, &my, &button, &ret, &keycode, &ret); */
  1760. X        if ( button != 0 ) {
  1761. X            return(MOUSE);
  1762. X        }
  1763. X        if ( statmouse() > 0 )
  1764. X            return(MOUSE);
  1765. X        if ( statconsole() )
  1766. X            return(getconsole());
  1767. X    }
  1768. X#else
  1769. X    return(getconsole());
  1770. X#endif
  1771. X}
  1772. X
  1773. Xflushconsole()
  1774. X{
  1775. X    while ( statconsole() )
  1776. X        getconsole();
  1777. X}
  1778. X
  1779. Xstatconsole()
  1780. X{
  1781. X    /* return(Bconstat(CONSOLE)); */
  1782. X    return(Cconis());
  1783. X}
  1784. X
  1785. Xgetconsole()
  1786. X{
  1787. X    /* return(Bconin(CONSOLE)); */
  1788. X    return(Crawcin());
  1789. X}
  1790. X
  1791. Xgetmidi()
  1792. X{
  1793. X    return(Bconin(MIDI));
  1794. X}
  1795. X
  1796. X/*ARGSUSED*/
  1797. Xsendmidi(c)
  1798. X{
  1799. X    Bconout(MIDI,c);
  1800. X}
  1801. X
  1802. Xflushmidi()
  1803. X{
  1804. X    while ( STATMIDI )
  1805. X        getmidi();
  1806. X}
  1807. X
  1808. Xlong milliclock()
  1809. X{
  1810. X    register long save_ssp=Super(0L);
  1811. X    register long uhz200= *(long *)0x4ba;
  1812. X    Super(save_ssp);
  1813. X    return(uhz200 * 5);
  1814. X}
  1815. X
  1816. Xmillisleep(n)
  1817. X{
  1818. X    long first = milliclock();
  1819. X    while ( milliclock() < (first+n) )
  1820. X        ;
  1821. X}
  1822. X
  1823. Xchar *
  1824. Xalloc(n)
  1825. X{
  1826. X    char *p;
  1827. X
  1828. X    if ( (p=malloc((unsigned)n)) == (char *)NULL ) {
  1829. X        printf("*** Whoops *** alloc has failed?!?  No more memory!\n");
  1830. X        fflush(stdout);
  1831. X        bye();
  1832. X    }
  1833. X    return(p);
  1834. X}
  1835. X
  1836. Xwindinit()
  1837. X{
  1838. X    Cols=80;
  1839. X    Rows=25;
  1840. X    Cursconf(1,NULL);
  1841. X}
  1842. X
  1843. Xwindgoto(r,c)
  1844. Xint r,c;
  1845. X{
  1846. X    mouseoff();
  1847. X    EscSeq('Y');
  1848. X    Cconout(r+040);
  1849. X    Cconout(c+040);
  1850. X}
  1851. X
  1852. Xwindeeol()
  1853. X{
  1854. X    mouseoff();
  1855. X    EscSeq('K');
  1856. X}
  1857. X
  1858. Xwinderaserow(r)
  1859. X{
  1860. X    windgoto(r,0);
  1861. X    windeeol();
  1862. X}
  1863. X
  1864. Xwindexit(r)
  1865. Xint r;
  1866. X{
  1867. X    exit(r);
  1868. X}
  1869. X
  1870. Xwindclear()
  1871. X{
  1872. X    mouseoff();
  1873. X    EscSeq('H');
  1874. X    EscSeq('J');
  1875. X}
  1876. X
  1877. X/* windgets - get a line of input from the console, handling backspaces */
  1878. Xwindgets(s)
  1879. Xchar *s;
  1880. X{
  1881. X    char *origs = s;
  1882. X    int c;
  1883. X
  1884. X    while ( (c=getconsole()) != '\n' && c!='\r' && c!= EOF ) {
  1885. X        if ( c == '\b' ) {
  1886. X            if ( s > origs ) {
  1887. X                windstr("\b \b");
  1888. X                s--;
  1889. X            }
  1890. X        }
  1891. X        else {
  1892. X            windputc(c);
  1893. X            *s++ = c;
  1894. X        }
  1895. X        windrefresh();
  1896. X    }
  1897. X    *s = '\0';
  1898. X}
  1899. X
  1900. Xwindstr(s)
  1901. Xchar *s;
  1902. X{
  1903. X    int c;
  1904. X
  1905. X    while ( (c=(*s++)) != '\0' )
  1906. X        windputc(c);
  1907. X}
  1908. X
  1909. Xwindputc(c)
  1910. Xint c;
  1911. X{
  1912. X    mouseoff();
  1913. X    Cconout(c);
  1914. X}
  1915. X
  1916. Xwindrefresh()
  1917. X{
  1918. X}
  1919. X
  1920. Xbeep()
  1921. X{
  1922. X    Cconout('\007');
  1923. X}
  1924. X
  1925. Xwindhigh()
  1926. X{
  1927. X}
  1928. X
  1929. Xwindnorm()
  1930. X{
  1931. X}
  1932. X
  1933. X/****************
  1934. X * openls(), nextls(), and closels() are used to scan the current directory.
  1935. X ***************/
  1936. X
  1937. Xchar Dtabuff[44];
  1938. Xlong Origdta;
  1939. Xint Atarifirst = 0;
  1940. X
  1941. Xchar *
  1942. Xopenls()
  1943. X{
  1944. X    int n, c;
  1945. X
  1946. X    Origdta = Fgetdta();
  1947. X    Fsetdta(Dtabuff);
  1948. X    Atarifirst = 1;
  1949. X}
  1950. Xchar *
  1951. Xnextls()
  1952. X{
  1953. X    static char fname[17];
  1954. X    int n, c;
  1955. X
  1956. X    if ( Atarifirst ) {
  1957. X        if ( Fsfirst("*.*",0x10) < 0 )
  1958. X            return(NULL);
  1959. X    }
  1960. X    else {
  1961. X        if ( Fsnext() < 0 )
  1962. X            return(NULL);
  1963. X    }
  1964. X    Atarifirst = 0;
  1965. X    for ( n=0; n<14; n++ ) {
  1966. X        c = fname[n] = Dtabuff[30+n];
  1967. X        /* ALL phrase names are lower case */
  1968. X        if ( c >= 'A' && c <= 'Z' )
  1969. X            fname[n] = c - 'A' + 'a';
  1970. X    }
  1971. X    fname[14] = '\0';
  1972. X    return(fname);
  1973. X}
  1974. Xclosels()
  1975. X{
  1976. X    Fsetdta((char *)Origdta);
  1977. X}
  1978. X
  1979. END_OF_FILE
  1980. if test 5590 -ne `wc -c <'st-mach.c'`; then
  1981.     echo shar: \"'st-mach.c'\" unpacked with wrong size!
  1982. fi
  1983. # end of 'st-mach.c'
  1984. fi
  1985. echo shar: End of archive 2 \(of 15\).
  1986. cp /dev/null ark2isdone
  1987. MISSING=""
  1988. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  1989.     if test ! -f ark${I}isdone ; then
  1990.     MISSING="${MISSING} ${I}"
  1991.     fi
  1992. done
  1993. if test "${MISSING}" = "" ; then
  1994.     echo You have unpacked all 15 archives.
  1995.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1996. else
  1997.     echo You still need to unpack the following archives:
  1998.     echo "        " ${MISSING}
  1999. fi
  2000. ##  End of shell archive.
  2001. exit 0
  2002.  
  2003.